<?php defined('BASEPATH') or exit('No direct script access allowed');

class Module_Voucher extends Module {

	public $version = 1.1;

	public function info()
	{
		return array(
			'name' => array(
				'nl' => 'Voucher',
				'en' => 'Voucher'
			),
			'description' => array(
				'nl' => 'Voucher Management',
				'en' => 'Voucher Management'
				),
			'frontend' => TRUE,
			'backend' => TRUE,
			'skip_xss'	=> TRUE,
			'menu'		=> 'Voucher',
			'sections' => array(
			    'vouchers' => array(
				    'name' => 'stoepje_voucher_title',
				    'uri' => 'admin/voucher',
				    'shortcuts' => array(
						array(
					 	   'name' => 'stoepje_voucher_create_title',
						    'uri' => 'admin/voucher/create',
						    'class' => 'add'
						),
					),
				),
				'prizes' => array(
				    'name' => 'stoepje_prize_list_title',
				    'uri' => 'admin/voucher/prizes',
				    'shortcuts' => array(
						array(
						    'name' => 'stoepje_prize_create_title',
						    'uri' => 'admin/voucher/prizes/create',
						    'class' => 'add'
						),
					),
				),
				'setting' => array(
				    'name' => 'stoepje_voucher_setting_title',
				    'uri' => 'admin/voucher/setting',
				),
			),
		);
	}

	public function install()
	{
		$this->db->query("
					CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('stoepje_prizes')." (
						`id` INT NOT NULL AUTO_INCREMENT ,
  						`name` VARCHAR(255) NULL ,
  						`description` VARCHAR(255) NULL ,
  						`image` VARCHAR(255) NULL ,
  						`email` TEXT NULL,
  						`created_time` VARCHAR(45) NULL ,
					  PRIMARY KEY (`id`)
					) ENGINE=InnoDB DEFAULT CHARSET=utf8
				");
		return $this->db->query("
			CREATE  TABLE IF NOT EXISTS ".$this->db->dbprefix('stoepje_vouchers')." (
						`id` INT NOT NULL AUTO_INCREMENT ,
				  		`code` VARCHAR(255) NULL ,
				  		`prize_id` INT NULL ,
				  		`description` TINYTEXT NULL ,
				  		`created_time` VARCHAR(45) NULL ,
				  		`status` INT NULL ,
			  			PRIMARY KEY (`id`)
					) ENGINE=InnoDB DEFAULT CHARSET=utf8
				");
	}

	public function uninstall()
	{
		return TRUE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}

	public function help()
	{
		// Return a string containing help info
		// You could include a file and return it here.
		return "This module has no inline docs as it does not have a back-end.";
	}
}
/* End of file details.php */